package br.com.klis.batendoumabola.client.util;

import br.com.klis.batendoumabola.client.exception.DaoException;
import br.com.klis.batendoumabola.client.exception.NotLoggedInException;
import br.com.klis.batendoumabola.shared.LoginInfo;

import com.google.gwt.user.client.Window;

public class Helper {
	public static void handleError(Throwable error, LoginInfo loginInfo) {
	    Window.alert(error.getMessage());
	    if (error instanceof NotLoggedInException) {
	      Window.Location.replace(loginInfo.getLogoutUrl());
	    }
	    //TODO Verificar tratamento DaoException
	    if (error instanceof DaoException) {
		      //Window.Location.replace(loginInfo.getLogoutUrl());
		}
  }
}
